#include "stm32f10x.h" // Device header
#include "Delay.h"
#include "LED.h"
#include "Switch.h"
#include "Buzzer.h"
#include "Light.h"
// #include "Light_Interrput.h"
#include "NOLED.h"
#include "string.h"
#include "Timer.h"
#include "Pwm.h"
#include "Car.h"
#include "InputCapture.h"

static uint16_t cnt = 0;


int main(void)
{
    Pwm_Init();
	LED_Init();
	// InputCapture_Init();
	InputCapture_Init2();
	NOLED_Init();
	NOLED_ShowLineString(0, 0, "freq:");
	NOLED_ShowLineString(2, 0, "duty:");
	Pwm_SetPrescaler(72 * 10000 / 655); // freq = 72 * 1000 * 1000 / psc / 100 = 72 * 10000
	Pwm_SetCompare(50);
	
    while (1) {
		// LED_Open();
		// for (int i = 0; i <= 100; i++)
		// {
		// 	Pwm_SetCompare(i);
		// 	Delay_ms(10);
		// }
		// for (int i = 0; i <= 100; i++)
		// {
		// 	Pwm_SetCompare(100 - i );
		// 	Delay_ms(10);
		// }
		uint16_t freq = Get_Freq();
		uint16_t duty = Get_Duty();
		NOLED_ShowLineNumber(1,0,freq);
		NOLED_ShowLineNumber(3,0,duty);
    }
}
